{% extends "layout.html" %}
{% macro selectinputdict(name, values, value='') -%}
    <select name="{{ name }}" id="{{ name }}">
    {% for k,v in values.items() %}
        <option value="{{ k }}"  {{ 'selected' if value==k }}>{{ v }}</option>
    {% endfor %}
    </select>
{%- endmacro %}


{% block body %}
  <div style="margin-left:10px;">
<h3>自动分类V2：选择随机森林模型</h3>

{{ PreviousTxt |safe }}
<table><tr><td>
<div class="panel panel-default" style='display: inline-block; width: 400px;margin-bottom: 0;'>
  <div class="panel-body">
    <form method="post">
      <table >
        <tbody><tr>
          <td >共同特征 &ge;  </td>
          <td><input style="width: 100px;" name="filt_featurenbr" id="filt_featurenbr" value="{{ request.form.get('filt_featurenbr','10') }}" type="text"></td>

        </tr><tr>
          <td>用标题过滤 :</td>
          <td><input style="width: 100px;" name="filt_title" id="filt_title" value="{{ request.form.get('filt_title','') }}" type="text"></td>
          <td rowspan="3" style="vertical-align: top"><button type="submit" class="btn btn-primary">搜索</button></td>
        </tr>
      </tbody></table>
    </form>
  </div></div></td></tr></table>
        <table class='table table-bordered table-verycondensed table-hover' style='width: 95%'>
                <tr><th style='width:20px'></th>
                <th># - 项目名称</th><th style='width:100px'># 已验证.</th><th style='width:100px'># 匹配特征</th>
                <th style='width:100px'>CNN网络</th></tr>
  {{ TblBody|safe }}
</table>

{# ----------- Partie Gestion des Taxon destination --------------------- #}
<p><a href="#TargetFilter" data-toggle="collapse" >
<span class="glyphicon glyphicon-plus-sign"></span> 高级设置</a></p>
<div id=TargetFilter class="panel panel-default collapse " style="margin-left: 0;margin-top: 5px;width: 800px;padding: 5px;" >

  预测对象 {{ selectinputdict("Perimeter",{'nmc':"未验证的对象",'all':"所有对象"},'nmc') }}

  <br>输入“Reset To Predicted” 来（重新）预测所选目录中所有经过验证的对象 :
  <input type="text" id="resetpredicted" value="" autocomplete="off" style="width: 150px;">
  <br>显示屏幕以映射类别 <input type="checkbox" id="displaytaxomap" value="Y">
  <br>其他应用 <input style="width: 600px" id="PostTaxoMapping" value="{{ g.posttaxomapping }}">
</div>
<style>
.showcat {cursor: pointer;color: #0a6aa1;float: right;font-size: small;text-decoration: underline;}
</style>

<button type="button" class="btn btn-primary" onclick="StartPrediction()">开始预测</button>
<script>
function StartPrediction() {
  var modeldir=$('.selmodel:checked').data('modeldir');
  if(modeldir===undefined) {
    alert("You must select a model first"); return;}
  var param={modeldir:modeldir,starttask:'Y'
    ,Perimeter:$('#Perimeter').val(),resetpredicted:$('#resetpredicted').val(),PostTaxoMapping:$('#PostTaxoMapping').val()};
    if($('#displaytaxomap').prop("checked")) {
      param.starttask = '';
      param.displaytaxomap='Y';
    }
  PostDynForm("?{{ url|safe }}",param);
}
$('.showcat').click(function () {
  $(this).next().toggle();

});
</script>
<div id="PopupDetails" class="modal " tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      ...
    </div>
  </div>
</div>

  </div>
{% endblock %}